import axios from 'axios';
import { API_MP_CARD_URL } from '@/config/api';
import { AnyObject, HttpResponse } from '@/types/global';
import { MpCard } from '@/types/mp';

export function createMpCard(data: AnyObject) {
  return axios.post(`${API_MP_CARD_URL}`, data);
}

export function updateMpCard(data: AnyObject) {
  return axios.put(`${API_MP_CARD_URL}`, data);
}

export function deleteMpCard(id: string) {
  return axios.delete(`${API_MP_CARD_URL}/${id}`);
}

export function pinMpCard(id: string) {
  return axios.post(`${API_MP_CARD_URL}/top/${id}`);
}

export function getMpCardList(data: AnyObject) {
  return axios.post<HttpResponse<MpCard[]>>(`/api/v1/mp/card`, null, {
    params: data,
  });
}
